using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using NUnit.Framework;

namespace nzmq.tests
{
    [TestFixture]
    public class use_NzmqPublisherSocket_and_NzmqSubscriberSocket
    {
        [Test]
        public void Broadcast_a_message()
        {
            using(var ctx = new NzmqContext())
            using(var pub = ctx.CreatePublisherSocket("inproc://pub"))
            using (var sub1 = ctx.CreateSubscriberSocket("inproc://pub"))
            using (var sub2 = ctx.CreateSubscriberSocket("inproc://pub"))
            {
                Thread.Sleep(200);

                pub.Broadcast("hello");

                Assert.AreEqual("hello", sub1.Receive());
                Assert.AreEqual("hello", sub2.Receive());
            }
        }
    }
}